using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Unit_Unit_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Unit.Unit);
            args = new Type[]{typeof(huqiang.Unit.UnitCarrier)};
            method = type.GetMethod("CreateMesh", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, CreateMesh_0);
            args = new Type[]{typeof(System.Single)};
            method = type.GetMethod("OnUpdate", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, OnUpdate_1);
            args = new Type[]{typeof(huqiang.Unit.Unit)};
            method = type.GetMethod("OnCollision", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, OnCollision_2);

            field = type.GetField("size", flag);
            app.RegisterCLRFieldGetter(field, get_size_0);
            app.RegisterCLRFieldSetter(field, set_size_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_size_0, AssignFromStack_size_0);
            field = type.GetField("color", flag);
            app.RegisterCLRFieldGetter(field, get_color_1);
            app.RegisterCLRFieldSetter(field, set_color_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_color_1, AssignFromStack_color_1);
            field = type.GetField("uv", flag);
            app.RegisterCLRFieldGetter(field, get_uv_2);
            app.RegisterCLRFieldSetter(field, set_uv_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_uv_2, AssignFromStack_uv_2);
            field = type.GetField("pivot", flag);
            app.RegisterCLRFieldGetter(field, get_pivot_3);
            app.RegisterCLRFieldSetter(field, set_pivot_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_pivot_3, AssignFromStack_pivot_3);
            field = type.GetField("localPosition", flag);
            app.RegisterCLRFieldGetter(field, get_localPosition_4);
            app.RegisterCLRFieldSetter(field, set_localPosition_4);
            app.RegisterCLRFieldBinding(field, CopyToStack_localPosition_4, AssignFromStack_localPosition_4);
            field = type.GetField("localScale", flag);
            app.RegisterCLRFieldGetter(field, get_localScale_5);
            app.RegisterCLRFieldSetter(field, set_localScale_5);
            app.RegisterCLRFieldBinding(field, CopyToStack_localScale_5, AssignFromStack_localScale_5);
            field = type.GetField("localRotate", flag);
            app.RegisterCLRFieldGetter(field, get_localRotate_6);
            app.RegisterCLRFieldSetter(field, set_localRotate_6);
            app.RegisterCLRFieldBinding(field, CopyToStack_localRotate_6, AssignFromStack_localRotate_6);
            field = type.GetField("time", flag);
            app.RegisterCLRFieldGetter(field, get_time_7);
            app.RegisterCLRFieldSetter(field, set_time_7);
            app.RegisterCLRFieldBinding(field, CopyToStack_time_7, AssignFromStack_time_7);
            field = type.GetField("active", flag);
            app.RegisterCLRFieldGetter(field, get_active_8);
            app.RegisterCLRFieldSetter(field, set_active_8);
            app.RegisterCLRFieldBinding(field, CopyToStack_active_8, AssignFromStack_active_8);
            field = type.GetField("show", flag);
            app.RegisterCLRFieldGetter(field, get_show_9);
            app.RegisterCLRFieldSetter(field, set_show_9);
            app.RegisterCLRFieldBinding(field, CopyToStack_show_9, AssignFromStack_show_9);
            field = type.GetField("collider", flag);
            app.RegisterCLRFieldGetter(field, get_collider_10);
            app.RegisterCLRFieldSetter(field, set_collider_10);
            app.RegisterCLRFieldBinding(field, CopyToStack_collider_10, AssignFromStack_collider_10);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Unit.Unit());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Unit.Unit[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* CreateMesh_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Unit.UnitCarrier @carrier = (huqiang.Unit.UnitCarrier)typeof(huqiang.Unit.UnitCarrier).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.Unit instance_of_this_method = (huqiang.Unit.Unit)typeof(huqiang.Unit.Unit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.CreateMesh(@carrier);

            return __ret;
        }

        static StackObject* OnUpdate_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Single @time = *(float*)&ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.Unit instance_of_this_method = (huqiang.Unit.Unit)typeof(huqiang.Unit.Unit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.OnUpdate(@time);

            return __ret;
        }

        static StackObject* OnCollision_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Unit.Unit @other = (huqiang.Unit.Unit)typeof(huqiang.Unit.Unit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            huqiang.Unit.Unit instance_of_this_method = (huqiang.Unit.Unit)typeof(huqiang.Unit.Unit).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.OnCollision(@other);

            return __ret;
        }


        static object get_size_0(ref object o)
        {
            return ((huqiang.Unit.Unit)o).size;
        }

        static StackObject* CopyToStack_size_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).size;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_size_0(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).size = (UnityEngine.Vector2)v;
        }

        static StackObject* AssignFromStack_size_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2 @size = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).size = @size;
            return ptr_of_this_method;
        }

        static object get_color_1(ref object o)
        {
            return ((huqiang.Unit.Unit)o).color;
        }

        static StackObject* CopyToStack_color_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).color;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_color_1(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).color = (UnityEngine.Color32)v;
        }

        static StackObject* AssignFromStack_color_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Color32 @color = (UnityEngine.Color32)typeof(UnityEngine.Color32).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).color = @color;
            return ptr_of_this_method;
        }

        static object get_uv_2(ref object o)
        {
            return ((huqiang.Unit.Unit)o).uv;
        }

        static StackObject* CopyToStack_uv_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).uv;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_uv_2(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).uv = (UnityEngine.Vector2[])v;
        }

        static StackObject* AssignFromStack_uv_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2[] @uv = (UnityEngine.Vector2[])typeof(UnityEngine.Vector2[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Unit.Unit)o).uv = @uv;
            return ptr_of_this_method;
        }

        static object get_pivot_3(ref object o)
        {
            return ((huqiang.Unit.Unit)o).pivot;
        }

        static StackObject* CopyToStack_pivot_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).pivot;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_pivot_3(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).pivot = (UnityEngine.Vector2)v;
        }

        static StackObject* AssignFromStack_pivot_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector2 @pivot = (UnityEngine.Vector2)typeof(UnityEngine.Vector2).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).pivot = @pivot;
            return ptr_of_this_method;
        }

        static object get_localPosition_4(ref object o)
        {
            return ((huqiang.Unit.Unit)o).localPosition;
        }

        static StackObject* CopyToStack_localPosition_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).localPosition;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_localPosition_4(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).localPosition = (UnityEngine.Vector3)v;
        }

        static StackObject* AssignFromStack_localPosition_4(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector3 @localPosition = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).localPosition = @localPosition;
            return ptr_of_this_method;
        }

        static object get_localScale_5(ref object o)
        {
            return ((huqiang.Unit.Unit)o).localScale;
        }

        static StackObject* CopyToStack_localScale_5(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).localScale;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_localScale_5(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).localScale = (UnityEngine.Vector3)v;
        }

        static StackObject* AssignFromStack_localScale_5(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Vector3 @localScale = (UnityEngine.Vector3)typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).localScale = @localScale;
            return ptr_of_this_method;
        }

        static object get_localRotate_6(ref object o)
        {
            return ((huqiang.Unit.Unit)o).localRotate;
        }

        static StackObject* CopyToStack_localRotate_6(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).localRotate;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_localRotate_6(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).localRotate = (UnityEngine.Quaternion)v;
        }

        static StackObject* AssignFromStack_localRotate_6(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            UnityEngine.Quaternion @localRotate = (UnityEngine.Quaternion)typeof(UnityEngine.Quaternion).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)16);
            ((huqiang.Unit.Unit)o).localRotate = @localRotate;
            return ptr_of_this_method;
        }

        static object get_time_7(ref object o)
        {
            return ((huqiang.Unit.Unit)o).time;
        }

        static StackObject* CopyToStack_time_7(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).time;
            __ret->ObjectType = ObjectTypes.Float;
            *(float*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_time_7(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).time = (System.Single)v;
        }

        static StackObject* AssignFromStack_time_7(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Single @time = *(float*)&ptr_of_this_method->Value;
            ((huqiang.Unit.Unit)o).time = @time;
            return ptr_of_this_method;
        }

        static object get_active_8(ref object o)
        {
            return ((huqiang.Unit.Unit)o).active;
        }

        static StackObject* CopyToStack_active_8(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).active;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_active_8(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).active = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_active_8(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @active = ptr_of_this_method->Value == 1;
            ((huqiang.Unit.Unit)o).active = @active;
            return ptr_of_this_method;
        }

        static object get_show_9(ref object o)
        {
            return ((huqiang.Unit.Unit)o).show;
        }

        static StackObject* CopyToStack_show_9(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).show;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_show_9(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).show = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_show_9(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @show = ptr_of_this_method->Value == 1;
            ((huqiang.Unit.Unit)o).show = @show;
            return ptr_of_this_method;
        }

        static object get_collider_10(ref object o)
        {
            return ((huqiang.Unit.Unit)o).collider;
        }

        static StackObject* CopyToStack_collider_10(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Unit.Unit)o).collider;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_collider_10(ref object o, object v)
        {
            ((huqiang.Unit.Unit)o).collider = (huqiang.Unit.UCollider2D)v;
        }

        static StackObject* AssignFromStack_collider_10(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            huqiang.Unit.UCollider2D @collider = (huqiang.Unit.UCollider2D)typeof(huqiang.Unit.UCollider2D).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Unit.Unit)o).collider = @collider;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Unit.Unit();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
